package com.ukao.cashregister.dialog;


import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.TextView;

import com.ukao.cashregister.R;
import com.ukao.cashregister.base.BaseDialogFragment;
import com.ukao.cashregister.eventbus.AppEvent;
import com.ukao.cashregister.widget.StateImageView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;


public class AllSelectDialogFragment extends BaseDialogFragment {

    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";
    @BindView(R.id.close_btn)
    StateImageView closeBtn;
    @BindView(R.id.title)
    TextView title;
    @BindView(R.id.build_btn)
    RadioButton buildBtn;
    @BindView(R.id.add_btn)
    RadioButton addBtn;
    @BindView(R.id.edit_sex_cancel)
    Button editSexCancel;
    @BindView(R.id.edit_sex_submit)
    Button editSexSubmit;
    Unbinder unbinder;
    @BindView(R.id.RadioGroup)
    android.widget.RadioGroup RadioGroup;

    // TODO: Rename and change types of parameters
    private String mParam1;
    private String mParam2;


    private int type;

    public static AllSelectDialogFragment newInstance(String param1, String param2) {
        AllSelectDialogFragment fragment = new AllSelectDialogFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, param1);
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParam1 = getArguments().getString(ARG_PARAM1);
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.fragment_all_shop_dialog, container, false);
        unbinder = ButterKnife.bind(this, view);
        title.setText("全选衣物");

        return view;
    }



    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }




    @OnClick({R.id.close_btn, R.id.edit_sex_cancel, R.id.edit_sex_submit})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.close_btn:
                dismiss();
                break;
            case R.id.edit_sex_cancel:
                dismiss();
                break;
            case R.id.edit_sex_submit:
                if (buildBtn.isChecked()) {
                    type = 1;
                } else {
                    type = 2;
                }
                AppEvent.postHasData(AppEvent.Message.allSelect, type);
                dismiss();
                break;
        }
    }
}
